﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HTTT.Bussiness;
using HTTT.DataAccess;

namespace HTTT.admin.controls
{
    public partial class ucAddUserRequestDetail : System.Web.UI.UserControl
    {
        private Guid _requestID;
        public Guid RequestID
        {
            get { return _requestID; }
            set { _requestID = value; LoadDetail(); }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadRequestDetail();
            LoadDetail();
        }
        private void LoadRequestDetail()
        {
            HT_RequestBO BO = new HT_RequestBO();
            HT_Request MyRequest = BO.GetHT_RequestById(RequestID);
            ltlActionName.Text = MyRequest.ActionName;
            txtFromRequest.Text = MyRequest.Note;
            txtRequestedBy.Text = MyRequest.Requestedby;
            txtRequestedDate.Text = MyRequest.RequestDate.ToString();
        }
        private void LoadDetail()
        {
            HT_RequestBO BO = new HT_RequestBO();
            HT_Request MyRequest = BO.GetHT_RequestById(RequestID);
            HT_UserBO UserBO = new HT_UserBO();
            HT_User currentUser = UserBO.BuildHTUserFromAddUserData(MyRequest.ActionDescription);
            UserDetail.UserInfo = currentUser;
            UserDetail.IsReadOnly = true;
        }
    }
}